import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import tailwindcss from "@tailwindcss/vite";
import { codeInspectorPlugin } from "code-inspector-plugin";

// https://vite.dev/config/
export default defineConfig({
  base: "./",

  plugins: [
    vue(),
    tailwindcss(),
    codeInspectorPlugin({
      bundler: "vite",
    }),
  ],

  resolve: {
    alias: {
      "@": "/src",
    },
  },

  server: {
    port: 8080,

    proxy: {
      "/API/api": {
        target: "http://localhost:9000", // 后端服务器地址
        changeOrigin: true, // 是否改变请求源
        rewrite: (path) => path.replace(/^\/API/, ""), // 可选，重写路径
      },
    },
  },
});
